package dbLayer;

import java.util.Date;
import java.util.List;

import modelLayer.Student;

public interface DBStudentIF {
	
	/**
	 * Inserts a new row into the database table. This method
	 * uses prepared statements to sanitize the database input.
	 * 
	 * @param 	name		String		name of the student
	 * @param 	cpr			String		ssn of the student
	 * @param 	address		String		address of the student
	 * @param 	phone		String		phone number of the student
	 * @param 	email		String		email of the student
	 * @param 	startDate	String		student enrollment date
	 * @param 	sfo			String		determines if the student is attending SFO or not
	 * @param 	clId		int			the id of the Class to be associated to the student
	 * @return 	rc			int			the count of rows changed in the database
	 */
	public int insert(String name, String cpr, String address, String phone, 
					String email, Date startDate, boolean sfo, int clId);
	
	/**
	 * Finds a row in the database table Student. 
	 * 
	 * @param	name				String			student name.
	 * @param	retrieveAssociation	boolean			determines if we're to retrieve additional info on the student
	 * @throws						Exception		throws SQL exceptions if the query isn't
	 * 												legal.
	 * @return						List<Student>	returns the students matching the search.
	 */
	public List<Student> find(String name, boolean retrieveAssociation);
	
	/**
	 * Finds a row in the database table Teacher. 
	 * 
	 * @param	id					int				student id.
	 * @param	retrieveAssociation	boolean			determines if we're to retrieve additional info on the student
	 * @throws						Exception		throws SQL exceptions if the query isn't
	 * 												legal.
	 * @return						List<Student>	returns the students matching the search.
	 */
	public Student findById(int id,  boolean retrieveAssociation);
	
	/**
	 * Finds all row in the database table Student.
	 * 
	 * @param 	retrieveAssociation	boolean 		determines if we're to retrieve additional info on the student
	 * @return 						List<Student>	a list containing instances of Student 
	 */
	public List<Student> getAll(boolean retrieveAssociation);
	
	/**
	 * Updates a row in the database table Student.
	 * 
	 * @param 	s		Student		an instance of Student to be updated
	 * @return 	rc		int 		the count of rows changed in the database
	 */
	public int update(Student s);
	
	/**
	 * Removes a row in the database table Student.
	 * 
	 * @param 	id		int			the id of the student to be removed from the database
	 * @return 	rc		int			the count of rows changed in the database
	 */
	public int remove(int id);
	
}